Integrand size = 39, antiderivative size = 224 \[ \int \cos (c+d x) (a+b \cos (c+d x))^2 \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {1}{8} \left (8 a A b+4 a^2 B+3 b^2 B+6 a b C\right ) x+\frac {\left (20 a b B+5 a^2 (3 A+2 C)+2 b^2 (5 A+4 C)\right ) \sin (c+d x)}{15 d}+\frac {\left (8 a A b+4 a^2 B+3 b^2 B+6 a b C\right ) \cos (c+d x) \sin (c+d x)}{8 d}+\frac {\left (5 A b^2+10 a b B+2 a^2 C+4 b^2 C\right ) \cos ^2(c+d x) \sin (c+d x)}{15 d}+\frac {b (5 b B+2 a C) \cos ^3(c+d x) \sin (c+d x)}{20 d}+\frac {C \cos ^2(c+d x) (a+b \cos (c+d x))^2 \sin (c+d x)}{5 d} \]
1/8*(8*A*a*b+4*B*a^2+3*B*b^2+6*C*a*b)*x+1/15*(20*B*a*b+5*a^2*(3*A+2*C)+2*b ^2*(5*A+4*C))*sin(d*x+c)/d+1/8*(8*A*a*b+4*B*a^2+3*B*b^2+6*C*a*b)*cos(d*x+c )*sin(d*x+c)/d+1/15*(5*A*b^2+10*B*a*b+2*C*a^2+4*C*b^2)*cos(d*x+c)^2*sin(d* x+c)/d+1/20*b*(5*B*b+2*C*a)*cos(d*x+c)^3*sin(d*x+c)/d+1/5*C*cos(d*x+c)^2*( a+b*cos(d*x+c))^2*sin(d*x+c)/d
Time = 2.28 (sec) , antiderivative size = 169, normalized size of antiderivative = 0.75 \[ \int \cos (c+d x) (a+b \cos (c+d x))^2 \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {60 \left (8 a A b+4 a^2 B+3 b^2 B+6 a b C\right ) (c+d x)+60 \left (12 a b B+b^2 (6 A+5 C)+a^2 (8 A+6 C)\right ) \sin (c+d x)+120 \left (a^2 B+b^2 B+2 a b (A+C)\right ) \sin (2 (c+d x))+10 \left (4 A b^2+8 a b B+4 a^2 C+5 b^2 C\right ) \sin (3 (c+d x))+15 b (b B+2 a C) \sin (4 (c+d x))+6 b^2 C \sin (5 (c+d x))}{480 d} \]
(60*(8*a*A*b + 4*a^2*B + 3*b^2*B + 6*a*b*C)*(c + d*x) + 60*(12*a*b*B + b^2 *(6*A + 5*C) + a^2*(8*A + 6*C))*Sin[c + d*x] + 120*(a^2*B + b^2*B + 2*a*b* (A + C))*Sin[2*(c + d*x)] + 10*(4*A*b^2 + 8*a*b*B + 4*a^2*C + 5*b^2*C)*Sin [3*(c + d*x)] + 15*b*(b*B + 2*a*C)*Sin[4*(c + d*x)] + 6*b^2*C*Sin[5*(c + d *x)])/(480*d)
Time = 0.86 (sec) , antiderivative size = 237, normalized size of antiderivative = 1.06, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.205, Rules used = {3042, 3528, 3042, 3512, 3042, 3502, 3042, 3213}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \cos (c+d x) (a+b \cos (c+d x))^2 \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \sin \left (c+d x+\frac {\pi }{2}\right ) \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^2 \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )dx\) |
\(\Big \downarrow \) 3528 |
\(\displaystyle \frac {1}{5} \int \cos (c+d x) (a+b \cos (c+d x)) \left ((5 b B+2 a C) \cos ^2(c+d x)+(5 A b+4 C b+5 a B) \cos (c+d x)+a (5 A+2 C)\right )dx+\frac {C \sin (c+d x) \cos ^2(c+d x) (a+b \cos (c+d x))^2}{5 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{5} \int \sin \left (c+d x+\frac {\pi }{2}\right ) \left (a+b \sin \left (c+d x+\frac {\pi }{2}\right )\right ) \left ((5 b B+2 a C) \sin \left (c+d x+\frac {\pi }{2}\right )^2+(5 A b+4 C b+5 a B) \sin \left (c+d x+\frac {\pi }{2}\right )+a (5 A+2 C)\right )dx+\frac {C \sin (c+d x) \cos ^2(c+d x) (a+b \cos (c+d x))^2}{5 d}\) |
\(\Big \downarrow \) 3512 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \int \cos (c+d x) \left (4 (5 A+2 C) a^2+4 \left (2 C a^2+10 b B a+5 A b^2+4 b^2 C\right ) \cos ^2(c+d x)+5 \left (4 B a^2+8 A b a+6 b C a+3 b^2 B\right ) \cos (c+d x)\right )dx+\frac {b (2 a C+5 b B) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {C \sin (c+d x) \cos ^2(c+d x) (a+b \cos (c+d x))^2}{5 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \int \sin \left (c+d x+\frac {\pi }{2}\right ) \left (4 (5 A+2 C) a^2+4 \left (2 C a^2+10 b B a+5 A b^2+4 b^2 C\right ) \sin \left (c+d x+\frac {\pi }{2}\right )^2+5 \left (4 B a^2+8 A b a+6 b C a+3 b^2 B\right ) \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx+\frac {b (2 a C+5 b B) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {C \sin (c+d x) \cos ^2(c+d x) (a+b \cos (c+d x))^2}{5 d}\) |
\(\Big \downarrow \) 3502 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \left (\frac {1}{3} \int \cos (c+d x) \left (4 \left (5 (3 A+2 C) a^2+20 b B a+2 b^2 (5 A+4 C)\right )+15 \left (4 B a^2+8 A b a+6 b C a+3 b^2 B\right ) \cos (c+d x)\right )dx+\frac {4 \sin (c+d x) \cos ^2(c+d x) \left (2 a^2 C+10 a b B+5 A b^2+4 b^2 C\right )}{3 d}\right )+\frac {b (2 a C+5 b B) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {C \sin (c+d x) \cos ^2(c+d x) (a+b \cos (c+d x))^2}{5 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \left (\frac {1}{3} \int \sin \left (c+d x+\frac {\pi }{2}\right ) \left (4 \left (5 (3 A+2 C) a^2+20 b B a+2 b^2 (5 A+4 C)\right )+15 \left (4 B a^2+8 A b a+6 b C a+3 b^2 B\right ) \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx+\frac {4 \sin (c+d x) \cos ^2(c+d x) \left (2 a^2 C+10 a b B+5 A b^2+4 b^2 C\right )}{3 d}\right )+\frac {b (2 a C+5 b B) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {C \sin (c+d x) \cos ^2(c+d x) (a+b \cos (c+d x))^2}{5 d}\) |
\(\Big \downarrow \) 3213 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \left (\frac {4 \sin (c+d x) \cos ^2(c+d x) \left (2 a^2 C+10 a b B+5 A b^2+4 b^2 C\right )}{3 d}+\frac {1}{3} \left (\frac {4 \sin (c+d x) \left (5 a^2 (3 A+2 C)+20 a b B+2 b^2 (5 A+4 C)\right )}{d}+\frac {15 \sin (c+d x) \cos (c+d x) \left (4 a^2 B+8 a A b+6 a b C+3 b^2 B\right )}{2 d}+\frac {15}{2} x \left (4 a^2 B+8 a A b+6 a b C+3 b^2 B\right )\right )\right )+\frac {b (2 a C+5 b B) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {C \sin (c+d x) \cos ^2(c+d x) (a+b \cos (c+d x))^2}{5 d}\) |
(C*Cos[c + d*x]^2*(a + b*Cos[c + d*x])^2*Sin[c + d*x])/(5*d) + ((b*(5*b*B + 2*a*C)*Cos[c + d*x]^3*Sin[c + d*x])/(4*d) + ((4*(5*A*b^2 + 10*a*b*B + 2* a^2*C + 4*b^2*C)*Cos[c + d*x]^2*Sin[c + d*x])/(3*d) + ((15*(8*a*A*b + 4*a^ 2*B + 3*b^2*B + 6*a*b*C)*x)/2 + (4*(20*a*b*B + 5*a^2*(3*A + 2*C) + 2*b^2*( 5*A + 4*C))*Sin[c + d*x])/d + (15*(8*a*A*b + 4*a^2*B + 3*b^2*B + 6*a*b*C)* Cos[c + d*x]*Sin[c + d*x])/(2*d))/3)/4)/5
3.10.47.3.1 Defintions of rubi rules used
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.) *(x_)]), x_Symbol] :> Simp[(2*a*c + b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Co s[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /; Free Q[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m + 2)) Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && !LtQ[m, -1]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f _.)*(x_)]^2), x_Symbol] :> Simp[(-C)*d*Cos[e + f*x]*Sin[e + f*x]*((a + b*Si n[e + f*x])^(m + 1)/(b*f*(m + 3))), x] + Simp[1/(b*(m + 3)) Int[(a + b*Si n[e + f*x])^m*Simp[a*C*d + A*b*c*(m + 3) + b*(B*c*(m + 3) + d*(C*(m + 2) + A*(m + 3)))*Sin[e + f*x] - (2*a*C*d - b*(c*C + B*d)*(m + 3))*Sin[e + f*x]^2 , x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && !LtQ[m, -1]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_ .) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Cos[e + f*x]*(a + b*Sin[e + f*x ])^m*((c + d*Sin[e + f*x])^(n + 1)/(d*f*(m + n + 2))), x] + Simp[1/(d*(m + n + 2)) Int[(a + b*Sin[e + f*x])^(m - 1)*(c + d*Sin[e + f*x])^n*Simp[a*A* d*(m + n + 2) + C*(b*c*m + a*d*(n + 1)) + (d*(A*b + a*B)*(m + n + 2) - C*(a *c - b*d*(m + n + 1)))*Sin[e + f*x] + (C*(a*d*m - b*c*(m + 1)) + b*B*d*(m + n + 2))*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, n} , x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && GtQ[ m, 0] && !(IGtQ[n, 0] && ( !IntegerQ[m] || (EqQ[a, 0] && NeQ[c, 0])))
Time = 0.34 (sec) , antiderivative size = 167, normalized size of antiderivative = 0.75
method | result | size |
parallelrisch | \(\frac {120 \left (B \,b^{2}+2 a b \left (A +C \right )+B \,a^{2}\right ) \sin \left (2 d x +2 c \right )+10 \left (\left (4 A +5 C \right ) b^{2}+8 B a b +4 a^{2} C \right ) \sin \left (3 d x +3 c \right )+15 \left (B \,b^{2}+2 a b C \right ) \sin \left (4 d x +4 c \right )+6 C \,b^{2} \sin \left (5 d x +5 c \right )+60 \left (b^{2} \left (6 A +5 C \right )+12 B a b +8 a^{2} \left (A +\frac {3 C}{4}\right )\right ) \sin \left (d x +c \right )+480 x \left (\frac {3 B \,b^{2}}{8}+a \left (A +\frac {3 C}{4}\right ) b +\frac {B \,a^{2}}{2}\right ) d}{480 d}\) | \(167\) |
parts | \(\frac {\left (2 a A b +B \,a^{2}\right ) \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {\left (B \,b^{2}+2 a b C \right ) \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}+\frac {\left (A \,b^{2}+2 B a b +a^{2} C \right ) \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3 d}+\frac {\sin \left (d x +c \right ) A \,a^{2}}{d}+\frac {C \,b^{2} \left (\frac {8}{3}+\cos ^{4}\left (d x +c \right )+\frac {4 \left (\cos ^{2}\left (d x +c \right )\right )}{3}\right ) \sin \left (d x +c \right )}{5 d}\) | \(173\) |
derivativedivides | \(\frac {\frac {C \,b^{2} \left (\frac {8}{3}+\cos ^{4}\left (d x +c \right )+\frac {4 \left (\cos ^{2}\left (d x +c \right )\right )}{3}\right ) \sin \left (d x +c \right )}{5}+B \,b^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+2 a b C \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {A \,b^{2} \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+\frac {2 B a b \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+\frac {a^{2} C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+2 a A b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+B \,a^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+A \,a^{2} \sin \left (d x +c \right )}{d}\) | \(244\) |
default | \(\frac {\frac {C \,b^{2} \left (\frac {8}{3}+\cos ^{4}\left (d x +c \right )+\frac {4 \left (\cos ^{2}\left (d x +c \right )\right )}{3}\right ) \sin \left (d x +c \right )}{5}+B \,b^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+2 a b C \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {A \,b^{2} \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+\frac {2 B a b \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+\frac {a^{2} C \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+2 a A b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+B \,a^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+A \,a^{2} \sin \left (d x +c \right )}{d}\) | \(244\) |
risch | \(x a A b +\frac {x B \,a^{2}}{2}+\frac {3 x B \,b^{2}}{8}+\frac {3 a b C x}{4}+\frac {\sin \left (d x +c \right ) A \,a^{2}}{d}+\frac {3 \sin \left (d x +c \right ) A \,b^{2}}{4 d}+\frac {3 \sin \left (d x +c \right ) B a b}{2 d}+\frac {3 \sin \left (d x +c \right ) a^{2} C}{4 d}+\frac {5 b^{2} C \sin \left (d x +c \right )}{8 d}+\frac {C \,b^{2} \sin \left (5 d x +5 c \right )}{80 d}+\frac {\sin \left (4 d x +4 c \right ) B \,b^{2}}{32 d}+\frac {\sin \left (4 d x +4 c \right ) a b C}{16 d}+\frac {\sin \left (3 d x +3 c \right ) A \,b^{2}}{12 d}+\frac {\sin \left (3 d x +3 c \right ) B a b}{6 d}+\frac {\sin \left (3 d x +3 c \right ) a^{2} C}{12 d}+\frac {5 \sin \left (3 d x +3 c \right ) C \,b^{2}}{48 d}+\frac {\sin \left (2 d x +2 c \right ) a A b}{2 d}+\frac {\sin \left (2 d x +2 c \right ) B \,a^{2}}{4 d}+\frac {\sin \left (2 d x +2 c \right ) B \,b^{2}}{4 d}+\frac {\sin \left (2 d x +2 c \right ) a b C}{2 d}\) | \(294\) |
norman | \(\frac {\left (a A b +\frac {1}{2} B \,a^{2}+\frac {3}{8} B \,b^{2}+\frac {3}{4} a b C \right ) x +\left (a A b +\frac {1}{2} B \,a^{2}+\frac {3}{8} B \,b^{2}+\frac {3}{4} a b C \right ) x \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (5 a A b +\frac {5}{2} B \,a^{2}+\frac {15}{8} B \,b^{2}+\frac {15}{4} a b C \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (5 a A b +\frac {5}{2} B \,a^{2}+\frac {15}{8} B \,b^{2}+\frac {15}{4} a b C \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (10 a A b +5 B \,a^{2}+\frac {15}{4} B \,b^{2}+\frac {15}{2} a b C \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (10 a A b +5 B \,a^{2}+\frac {15}{4} B \,b^{2}+\frac {15}{2} a b C \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {4 \left (45 A \,a^{2}+25 A \,b^{2}+50 B a b +25 a^{2} C +29 C \,b^{2}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{15 d}+\frac {\left (8 A \,a^{2}-8 a A b +8 A \,b^{2}-4 B \,a^{2}+16 B a b -5 B \,b^{2}+8 a^{2} C -10 a b C +8 C \,b^{2}\right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {\left (8 A \,a^{2}+8 a A b +8 A \,b^{2}+4 B \,a^{2}+16 B a b +5 B \,b^{2}+8 a^{2} C +10 a b C +8 C \,b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}+\frac {\left (48 A \,a^{2}-24 a A b +32 A \,b^{2}-12 B \,a^{2}+64 B a b -3 B \,b^{2}+32 a^{2} C -6 a b C +16 C \,b^{2}\right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}+\frac {\left (48 A \,a^{2}+24 a A b +32 A \,b^{2}+12 B \,a^{2}+64 B a b +3 B \,b^{2}+32 a^{2} C +6 a b C +16 C \,b^{2}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{5}}\) | \(537\) |
1/480*(120*(B*b^2+2*a*b*(A+C)+B*a^2)*sin(2*d*x+2*c)+10*((4*A+5*C)*b^2+8*B* a*b+4*a^2*C)*sin(3*d*x+3*c)+15*(B*b^2+2*C*a*b)*sin(4*d*x+4*c)+6*C*b^2*sin( 5*d*x+5*c)+60*(b^2*(6*A+5*C)+12*B*a*b+8*a^2*(A+3/4*C))*sin(d*x+c)+480*x*(3 /8*B*b^2+a*(A+3/4*C)*b+1/2*B*a^2)*d)/d
Time = 0.28 (sec) , antiderivative size = 171, normalized size of antiderivative = 0.76 \[ \int \cos (c+d x) (a+b \cos (c+d x))^2 \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {15 \, {\left (4 \, B a^{2} + 2 \, {\left (4 \, A + 3 \, C\right )} a b + 3 \, B b^{2}\right )} d x + {\left (24 \, C b^{2} \cos \left (d x + c\right )^{4} + 30 \, {\left (2 \, C a b + B b^{2}\right )} \cos \left (d x + c\right )^{3} + 40 \, {\left (3 \, A + 2 \, C\right )} a^{2} + 160 \, B a b + 16 \, {\left (5 \, A + 4 \, C\right )} b^{2} + 8 \, {\left (5 \, C a^{2} + 10 \, B a b + {\left (5 \, A + 4 \, C\right )} b^{2}\right )} \cos \left (d x + c\right )^{2} + 15 \, {\left (4 \, B a^{2} + 2 \, {\left (4 \, A + 3 \, C\right )} a b + 3 \, B b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{120 \, d} \]
integrate(cos(d*x+c)*(a+b*cos(d*x+c))^2*(A+B*cos(d*x+c)+C*cos(d*x+c)^2),x, algorithm="fricas")
1/120*(15*(4*B*a^2 + 2*(4*A + 3*C)*a*b + 3*B*b^2)*d*x + (24*C*b^2*cos(d*x + c)^4 + 30*(2*C*a*b + B*b^2)*cos(d*x + c)^3 + 40*(3*A + 2*C)*a^2 + 160*B* a*b + 16*(5*A + 4*C)*b^2 + 8*(5*C*a^2 + 10*B*a*b + (5*A + 4*C)*b^2)*cos(d* x + c)^2 + 15*(4*B*a^2 + 2*(4*A + 3*C)*a*b + 3*B*b^2)*cos(d*x + c))*sin(d* x + c))/d
Leaf count of result is larger than twice the leaf count of optimal. 570 vs. \(2 (228) = 456\).
Time = 0.29 (sec) , antiderivative size = 570, normalized size of antiderivative = 2.54 \[ \int \cos (c+d x) (a+b \cos (c+d x))^2 \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\begin {cases} \frac {A a^{2} \sin {\left (c + d x \right )}}{d} + A a b x \sin ^{2}{\left (c + d x \right )} + A a b x \cos ^{2}{\left (c + d x \right )} + \frac {A a b \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{d} + \frac {2 A b^{2} \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {A b^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {B a^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {B a^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {B a^{2} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {4 B a b \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {2 B a b \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {3 B b^{2} x \sin ^{4}{\left (c + d x \right )}}{8} + \frac {3 B b^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {3 B b^{2} x \cos ^{4}{\left (c + d x \right )}}{8} + \frac {3 B b^{2} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} + \frac {5 B b^{2} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} + \frac {2 C a^{2} \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {C a^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {3 C a b x \sin ^{4}{\left (c + d x \right )}}{4} + \frac {3 C a b x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{2} + \frac {3 C a b x \cos ^{4}{\left (c + d x \right )}}{4} + \frac {3 C a b \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 d} + \frac {5 C a b \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{4 d} + \frac {8 C b^{2} \sin ^{5}{\left (c + d x \right )}}{15 d} + \frac {4 C b^{2} \sin ^{3}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{3 d} + \frac {C b^{2} \sin {\left (c + d x \right )} \cos ^{4}{\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \cos {\left (c \right )}\right )^{2} \left (A + B \cos {\left (c \right )} + C \cos ^{2}{\left (c \right )}\right ) \cos {\left (c \right )} & \text {otherwise} \end {cases} \]
Piecewise((A*a**2*sin(c + d*x)/d + A*a*b*x*sin(c + d*x)**2 + A*a*b*x*cos(c + d*x)**2 + A*a*b*sin(c + d*x)*cos(c + d*x)/d + 2*A*b**2*sin(c + d*x)**3/ (3*d) + A*b**2*sin(c + d*x)*cos(c + d*x)**2/d + B*a**2*x*sin(c + d*x)**2/2 + B*a**2*x*cos(c + d*x)**2/2 + B*a**2*sin(c + d*x)*cos(c + d*x)/(2*d) + 4 *B*a*b*sin(c + d*x)**3/(3*d) + 2*B*a*b*sin(c + d*x)*cos(c + d*x)**2/d + 3* B*b**2*x*sin(c + d*x)**4/8 + 3*B*b**2*x*sin(c + d*x)**2*cos(c + d*x)**2/4 + 3*B*b**2*x*cos(c + d*x)**4/8 + 3*B*b**2*sin(c + d*x)**3*cos(c + d*x)/(8* d) + 5*B*b**2*sin(c + d*x)*cos(c + d*x)**3/(8*d) + 2*C*a**2*sin(c + d*x)** 3/(3*d) + C*a**2*sin(c + d*x)*cos(c + d*x)**2/d + 3*C*a*b*x*sin(c + d*x)** 4/4 + 3*C*a*b*x*sin(c + d*x)**2*cos(c + d*x)**2/2 + 3*C*a*b*x*cos(c + d*x) **4/4 + 3*C*a*b*sin(c + d*x)**3*cos(c + d*x)/(4*d) + 5*C*a*b*sin(c + d*x)* cos(c + d*x)**3/(4*d) + 8*C*b**2*sin(c + d*x)**5/(15*d) + 4*C*b**2*sin(c + d*x)**3*cos(c + d*x)**2/(3*d) + C*b**2*sin(c + d*x)*cos(c + d*x)**4/d, Ne (d, 0)), (x*(a + b*cos(c))**2*(A + B*cos(c) + C*cos(c)**2)*cos(c), True))
Time = 0.21 (sec) , antiderivative size = 233, normalized size of antiderivative = 1.04 \[ \int \cos (c+d x) (a+b \cos (c+d x))^2 \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {120 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} B a^{2} - 160 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} C a^{2} + 240 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a b - 320 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B a b + 30 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} C a b - 160 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} A b^{2} + 15 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} B b^{2} + 32 \, {\left (3 \, \sin \left (d x + c\right )^{5} - 10 \, \sin \left (d x + c\right )^{3} + 15 \, \sin \left (d x + c\right )\right )} C b^{2} + 480 \, A a^{2} \sin \left (d x + c\right )}{480 \, d} \]
integrate(cos(d*x+c)*(a+b*cos(d*x+c))^2*(A+B*cos(d*x+c)+C*cos(d*x+c)^2),x, algorithm="maxima")
1/480*(120*(2*d*x + 2*c + sin(2*d*x + 2*c))*B*a^2 - 160*(sin(d*x + c)^3 - 3*sin(d*x + c))*C*a^2 + 240*(2*d*x + 2*c + sin(2*d*x + 2*c))*A*a*b - 320*( sin(d*x + c)^3 - 3*sin(d*x + c))*B*a*b + 30*(12*d*x + 12*c + sin(4*d*x + 4 *c) + 8*sin(2*d*x + 2*c))*C*a*b - 160*(sin(d*x + c)^3 - 3*sin(d*x + c))*A* b^2 + 15*(12*d*x + 12*c + sin(4*d*x + 4*c) + 8*sin(2*d*x + 2*c))*B*b^2 + 3 2*(3*sin(d*x + c)^5 - 10*sin(d*x + c)^3 + 15*sin(d*x + c))*C*b^2 + 480*A*a ^2*sin(d*x + c))/d
Time = 0.32 (sec) , antiderivative size = 184, normalized size of antiderivative = 0.82 \[ \int \cos (c+d x) (a+b \cos (c+d x))^2 \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {C b^{2} \sin \left (5 \, d x + 5 \, c\right )}{80 \, d} + \frac {1}{8} \, {\left (4 \, B a^{2} + 8 \, A a b + 6 \, C a b + 3 \, B b^{2}\right )} x + \frac {{\left (2 \, C a b + B b^{2}\right )} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} + \frac {{\left (4 \, C a^{2} + 8 \, B a b + 4 \, A b^{2} + 5 \, C b^{2}\right )} \sin \left (3 \, d x + 3 \, c\right )}{48 \, d} + \frac {{\left (B a^{2} + 2 \, A a b + 2 \, C a b + B b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {{\left (8 \, A a^{2} + 6 \, C a^{2} + 12 \, B a b + 6 \, A b^{2} + 5 \, C b^{2}\right )} \sin \left (d x + c\right )}{8 \, d} \]
1/80*C*b^2*sin(5*d*x + 5*c)/d + 1/8*(4*B*a^2 + 8*A*a*b + 6*C*a*b + 3*B*b^2 )*x + 1/32*(2*C*a*b + B*b^2)*sin(4*d*x + 4*c)/d + 1/48*(4*C*a^2 + 8*B*a*b + 4*A*b^2 + 5*C*b^2)*sin(3*d*x + 3*c)/d + 1/4*(B*a^2 + 2*A*a*b + 2*C*a*b + B*b^2)*sin(2*d*x + 2*c)/d + 1/8*(8*A*a^2 + 6*C*a^2 + 12*B*a*b + 6*A*b^2 + 5*C*b^2)*sin(d*x + c)/d
Time = 3.42 (sec) , antiderivative size = 256, normalized size of antiderivative = 1.14 \[ \int \cos (c+d x) (a+b \cos (c+d x))^2 \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {30\,B\,a^2\,\sin \left (2\,c+2\,d\,x\right )+10\,A\,b^2\,\sin \left (3\,c+3\,d\,x\right )+30\,B\,b^2\,\sin \left (2\,c+2\,d\,x\right )+10\,C\,a^2\,\sin \left (3\,c+3\,d\,x\right )+\frac {15\,B\,b^2\,\sin \left (4\,c+4\,d\,x\right )}{4}+\frac {25\,C\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{2}+\frac {3\,C\,b^2\,\sin \left (5\,c+5\,d\,x\right )}{2}+120\,A\,a^2\,\sin \left (c+d\,x\right )+90\,A\,b^2\,\sin \left (c+d\,x\right )+90\,C\,a^2\,\sin \left (c+d\,x\right )+75\,C\,b^2\,\sin \left (c+d\,x\right )+60\,A\,a\,b\,\sin \left (2\,c+2\,d\,x\right )+20\,B\,a\,b\,\sin \left (3\,c+3\,d\,x\right )+60\,C\,a\,b\,\sin \left (2\,c+2\,d\,x\right )+\frac {15\,C\,a\,b\,\sin \left (4\,c+4\,d\,x\right )}{2}+60\,B\,a^2\,d\,x+45\,B\,b^2\,d\,x+180\,B\,a\,b\,\sin \left (c+d\,x\right )+120\,A\,a\,b\,d\,x+90\,C\,a\,b\,d\,x}{120\,d} \]
(30*B*a^2*sin(2*c + 2*d*x) + 10*A*b^2*sin(3*c + 3*d*x) + 30*B*b^2*sin(2*c + 2*d*x) + 10*C*a^2*sin(3*c + 3*d*x) + (15*B*b^2*sin(4*c + 4*d*x))/4 + (25 *C*b^2*sin(3*c + 3*d*x))/2 + (3*C*b^2*sin(5*c + 5*d*x))/2 + 120*A*a^2*sin( c + d*x) + 90*A*b^2*sin(c + d*x) + 90*C*a^2*sin(c + d*x) + 75*C*b^2*sin(c + d*x) + 60*A*a*b*sin(2*c + 2*d*x) + 20*B*a*b*sin(3*c + 3*d*x) + 60*C*a*b* sin(2*c + 2*d*x) + (15*C*a*b*sin(4*c + 4*d*x))/2 + 60*B*a^2*d*x + 45*B*b^2 *d*x + 180*B*a*b*sin(c + d*x) + 120*A*a*b*d*x + 90*C*a*b*d*x)/(120*d)